package com.zjc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zjc.pojo.Bulider;
import com.zjc.mapper.BuliderMapper;
import com.zjc.service.BuliderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 周佳成
 * @since 2023-09-17
 */
@Service
public class BuliderServiceImpl extends ServiceImpl<BuliderMapper, Bulider> implements BuliderService {
	@Resource
	BuliderMapper buliderMapper;
	/**
	 * <p>
	 *  服务方法,检验楼栋是否存在
	 * </p>
	 *
	 * @author 周佳成
	 * @since 2023-09-17
	 */
	@Override
	public boolean isExistBulider(Integer id) {
		LambdaQueryWrapper<Bulider> lambdaQueryWrapper = new LambdaQueryWrapper<>();
		lambdaQueryWrapper.eq(Bulider::getLdId,id);
		Bulider bulider = buliderMapper.selectOne(lambdaQueryWrapper);
		return bulider!=null;
	}

	@Override
	public int BuliderType(Integer id) {
		LambdaQueryWrapper<Bulider> lambdaQueryWrapper = new LambdaQueryWrapper<>();
		lambdaQueryWrapper.eq(Bulider::getLdId,id);
		Bulider bulider = buliderMapper.selectOne(lambdaQueryWrapper);
		if(bulider!=null){
			return bulider.getLdType();
		}
		else{
			return  -1;
		}
	}
	/**
	 * <p>
	 *  服务方法,返回楼栋的类型
	 * </p>
	 *
	 * @author 周佳成
	 * @since 2023-09-17
	 */




}
